﻿using SoundDesigner.Samples;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using System.Windows.Forms;

namespace ConsoleApp1
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }
    }

    //class Program
    //{
    //    [SetUp]
    //    public void Setup()
    //    {
    //        Environment.SetEnvironmentVariable("SD_MODULE_PATH", AppDomain.CurrentDomain.BaseDirectory);
    //        Environment.SetEnvironmentVariable("ARK_ALG_MODULE_PATH", AppDomain.CurrentDomain.BaseDirectory);
    //        Environment.SetEnvironmentVariable("SD_CONFIG_PATH", AppDomain.CurrentDomain.BaseDirectory+ @"\sd.config");
    //        TestContext.Progress.WriteLine($"AppDomain base dir {AppDomain.CurrentDomain.BaseDirectory}");
    //    }

    //    [Test]
    //    public async Task Test1()
    //    {
    //        var pm = new ProductManager();
    //        var lib = "E7160SL" + ".library";
    //        pm.Initialize(lib, 0, programmer: Constants.Programmer);
    //        Console.WriteLine($"ProductManager is initialized");

    //        await pm.ConnectAsync(SDLib.CommunicationPort.kLeft);

    //        var cdi = pm.GetConnectedDeviceInfo(SDLib.CommunicationPort.kLeft);

    //        Console.WriteLine(
    //        $"LibraryId                {cdi?.LibraryId}\n" +
    //        $"ProductId                {cdi?.ProductId}\n" +
    //        $"ChipId                   {cdi?.ChipId}\n" +
    //        $"ChipVersion              {cdi?.ChipVersion}\n" +
    //        $"HybridId                 {cdi?.HybridId}\n" +
    //        $"FirmwareId               {cdi?.FirmwareId}\n" +
    //        $"FirmwareVersion          {cdi?.FirmwareVersion}\n" +
    //        $"SerialId                 {cdi?.SerialId}\n" +
    //        $"IsValid                  {cdi?.IsValid}\n" +
    //        $"ParameterLockState       {cdi?.ParameterLockState}\n" +
    //        $"RadioApplicationVersion  {cdi?.RadioApplicationVersion}\n" +
    //        $"RadioBootloaderVersion   {cdi?.RadioBootloaderVersion}\n" +
    //        $"RadioSoftDeviceVersion   {cdi?.RadioSoftDeviceVersion}\n" +
    //        $"HybridSerial             {cdi?.HybridSerial}\n" +
    //        $"HybridRevision           {cdi?.HybridRevision}");

    //        Assert.Pass();
    //    }

    //    static async Task Main(string[] args)
    //    {
    //        var pm = new ProductManager();
    //        var lib = "E7111V2" + ".library";
    //        pm.Initialize(lib, 0, programmer: Constants.Programmer);
    //        Console.WriteLine($"ProductManager is initialized");

    //        await pm.ConnectAsync(SDLib.CommunicationPort.kLeft);

    //        var cdi = pm.GetConnectedDeviceInfo(SDLib.CommunicationPort.kLeft);

    //        Console.WriteLine(
    //        $"LibraryId                {cdi?.LibraryId}\n" +
    //        $"ProductId                {cdi?.ProductId}\n" +
    //        $"ChipId                   {cdi?.ChipId}\n" +
    //        $"ChipVersion              {cdi?.ChipVersion}\n" +
    //        $"HybridId                 {cdi?.HybridId}\n" +
    //        $"FirmwareId               {cdi?.FirmwareId}\n" +
    //        $"FirmwareVersion          {cdi?.FirmwareVersion}\n" +
    //        $"SerialId                 {cdi?.SerialId}\n" +
    //        $"IsValid                  {cdi?.IsValid}\n" +
    //        $"ParameterLockState       {cdi?.ParameterLockState}\n" +
    //        $"RadioApplicationVersion  {cdi?.RadioApplicationVersion}\n" +
    //        $"RadioBootloaderVersion   {cdi?.RadioBootloaderVersion}\n" +
    //        $"RadioSoftDeviceVersion   {cdi?.RadioSoftDeviceVersion}\n" +
    //        $"HybridSerial             {cdi?.HybridSerial}\n" +
    //        $"HybridRevision           {cdi?.HybridRevision}");
    //    }
    //}
}
